package com.wsdcd.zlg.util;

public class SystemContext {
	private static ThreadLocal<Integer> page = new ThreadLocal<Integer>();
	private static ThreadLocal<Integer> limit = new ThreadLocal<Integer>();
	private static ThreadLocal<String> likeKey = new ThreadLocal<String>();
	private static ThreadLocal<String> likeValue = new ThreadLocal<String>();
	public static int getPage() {
		// 起始值 = (页码-1) * 每页条数
		return (page.get()-1)*limit.get();
	}
	public static void setPage(int page) {
		SystemContext.page.set(page);
	}
	public static int getLimit() {
		return limit.get();
	}
	public static void setLimit(int limit) {
		SystemContext.limit.set(limit);
	}
	public static String getLikeKey() {
		return likeKey.get();
	}
	public static void setLikeKey(String likeKey) {
		SystemContext.likeKey.set(likeKey);
	}
	public static String getLikeValue() {
		return likeValue.get();
	}
	public static void setLikeValue(String likeValue) {
		SystemContext.likeValue.set(likeValue);
	}
	
	
	public static void removePage() {
		page.remove();
	}
	public static void removeLimit() {
		limit.remove();
	}
	public static void removeLikeKey() {
		likeKey.remove();
	}
	public static void removeLikeValue() {
		likeValue.remove();
	}
}
